/*
 * Copyright (c) 2006-2020, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2021-02-15     tinnu       the first version
 */
#ifndef APPLICATIONS_MY_SYS_H_
#define APPLICATIONS_MY_SYS_H_

//#include "arm_math.h"
#include "at32f4xx.h"

void delay_us(uint32_t n);
void delay_ms(uint32_t n);

void PRINT_UART1(char *t_char);

#define LED_NUM     4
typedef enum
{
  LED1 = 0,
  LED2,
  LED3,
  LED4
}LED_Type;

#define LED1_PIN                0
#define LED1_GPIO               NULL
#define LED1_GPIO_RCC_CLK       0

#define LED2_PIN                GPIO_Pins_13
#define LED2_GPIO               GPIOD
#define LED2_GPIO_RCC_CLK       RCC_APB2PERIPH_GPIOD

#define LED3_PIN                GPIO_Pins_14
#define LED3_GPIO               GPIOD
#define LED3_GPIO_RCC_CLK       RCC_APB2PERIPH_GPIOD

#define LED4_PIN                GPIO_Pins_15
#define LED4_GPIO               GPIOD
#define LED4_GPIO_RCC_CLK       RCC_APB2PERIPH_GPIOD

void AT32_LEDn_Init();
void AT32_LEDn_ON(LED_Type led);
void AT32_LEDn_OFF(LED_Type led);
void AT32_LEDn_Toggle(LED_Type led);

int ftoa(char *str, double num);

#endif /* APPLICATIONS_MY_SYS_H_ */
